package textrpg.guihandlers;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import textrpg.Loader;
import textrpg.player.inventory.Inventory;

public class InventoryGui {
    
    Inventory invent = new Inventory();
    public JButton viewInventoryButton;
    
    public InventoryGui() {  
        viewInventoryButton = new JButton("View inventory");
        viewInventoryButton.setPreferredSize(new Dimension(40, 40));
        viewInventoryButton.setAlignmentX(Component.CENTER_ALIGNMENT);
        viewInventoryButton.addActionListener(new ViewInventoryListener());
    }
    
    private class ViewInventoryListener implements ActionListener {

        @Override
        public void actionPerformed(ActionEvent ae) { 
           // invent.viewInventory();
            GuiCoreInitializer.consoleDisplay.append(Loader.updateConsole());
            GuiCoreInitializer.consoleDisplay.setCaretPosition(GuiCoreInitializer.consoleDisplay.getDocument().getLength());
        }    
    }
}
